package cn.iocoder.yudao.module.biz.dal.mysql.customer;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.customer.CustomerArchiveDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.customer.vo.*;

import java.util.List;
import java.util.Map;

/**
 * 客户档案 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CustomerArchiveMapper extends BaseMapperX<CustomerArchiveDO> {

    default PageResult<CustomerArchiveDO> selectPage(CustomerArchivePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerArchiveDO>()
                .likeIfPresent(CustomerArchiveDO::getName, reqVO.getName())
                .eqIfPresent(CustomerArchiveDO::getCode, reqVO.getCode())
                .likeIfPresent(CustomerArchiveDO::getPreName, reqVO.getPreName())
                .eqIfPresent(CustomerArchiveDO::getManageUnit, reqVO.getManageUnit())
                .eqIfPresent(CustomerArchiveDO::getArea, reqVO.getArea())
                .eqIfPresent(CustomerArchiveDO::getPosition, reqVO.getPosition())
                .eqIfPresent(CustomerArchiveDO::getAddress, reqVO.getAddress())
                .eqIfPresent(CustomerArchiveDO::getIndustry, reqVO.getIndustry())
                .likeIfPresent(CustomerArchiveDO::getContactName, reqVO.getContactName())
                .eqIfPresent(CustomerArchiveDO::getContactNumber, reqVO.getContactNumber())
                .eqIfPresent(CustomerArchiveDO::getContactDuty, reqVO.getContactDuty())
                .eqIfPresent(CustomerArchiveDO::getContactAge, reqVO.getContactAge())
                .eqIfPresent(CustomerArchiveDO::getIntroduce, reqVO.getIntroduce())
                .eqIfPresent(CustomerArchiveDO::getBusinessSource, reqVO.getBusinessSource())
                .eqIfPresent(CustomerArchiveDO::getCompanyScale, reqVO.getCompanyScale())
                .eqIfPresent(CustomerArchiveDO::getCustomerRequire, reqVO.getCustomerRequire())
                .eqIfPresent(CustomerArchiveDO::getPowerScene, reqVO.getPowerScene())
                .eqIfPresent(CustomerArchiveDO::getSignDifficulty, reqVO.getSignDifficulty())
                .eqIfPresent(CustomerArchiveDO::getReceiveDifficulty, reqVO.getReceiveDifficulty())
                .likeIfPresent(CustomerArchiveDO::getDirectorName, reqVO.getDirectorName())
                .eqIfPresent(CustomerArchiveDO::getDirectorNumber, reqVO.getDirectorNumber())
                .eqIfPresent(CustomerArchiveDO::getDirectorDuty, reqVO.getDirectorDuty())
                .eqIfPresent(CustomerArchiveDO::getDirectorAge, reqVO.getDirectorAge())
                .eqIfPresent(CustomerArchiveDO::getPowerIndustryKnown, reqVO.getPowerIndustryKnown())
                .eqIfPresent(CustomerArchiveDO::getPowerKnowledge, reqVO.getPowerKnowledge())
                .eqIfPresent(CustomerArchiveDO::getSpecialRemark, reqVO.getSpecialRemark())
                .betweenIfPresent(CustomerArchiveDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CustomerArchiveDO::getOwnerUserId, reqVO.getOwnerUserId())
                .eqIfPresent(CustomerArchiveDO::getServiceStatus, reqVO.getServiceStatus())
                .orderByDesc(CustomerArchiveDO::getId));
    }

    List<Map<String,Object>> getSimpleList(CustomerArchivePageReqVO pageReqVO);
}